﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GestionCegep
{
    // Pop-up qui apparait pour l'insertion des cours et des etudiants
    public partial class FrmInput : Form
    {
        string defaultText;

        public FrmInput()
        {
            InitializeComponent();
        }

        public string InfoText
        {
            get
            {
                return lblInfoText.Text;
            }
            set
            {
                lblInfoText.Text = value;
            }
        }

        public string InputText
        {
            get
            {
                return maskedTextBox1.Text;
            }
            set
            {
                maskedTextBox1.Text = value;
            }
        }

        public DialogResult ShowDialog(string infoText, string defaultInputText, string mask)
        {
            InfoText = infoText;
            defaultText = defaultInputText;
            InputText = defaultInputText;
            maskedTextBox1.Mask = mask;
            return this.ShowDialog();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(InputText) && !defaultText.Equals(InputText))
            {
                DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }

        private void btnAnnuler_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }
    }
}
